Skip to content

Split secrets out of .env into .env.secrets - #56

Merged
roznet merged 1 commit into
mainfrom
env-secrets-split
Nov 5, 2026
Merged

roznet merged 1 commit into
mainfrom
env-secrets-split

Conversation

@roznet

@roznet roznet commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Same split as roznet/flyfun-weather#972 and roznet/flyfun-apps#41: plain config stays in .env, and secrets (DATABASE_URL, JWT_SECRET, GOOGLE_CLIENT_SECRET, APPLE_PRIVATE_KEY) move to .env.secrets. The owner's config repo keeps that file sops-encrypted, and syncfiles decrypts it on the host (mode 600).

No behaviour change until a host has a .env.secrets.

  • docker-compose.yml: .env.secrets is an optional second env_file. Only HOST_DATA_DIR is interpolated, so moving keys out of .env can't blank anything (unlike flyfun-apps' environment: pass-throughs).
  • .gitignore / .dockerignore: .env.* is now ignored and both samples are re-included. The old .env entries didn't cover .env.secrets, which matters for this public repo and for the image build context.
  • scripts/asc.py, scripts/play.py: load .env.secrets after .env. A missing file is a silent no-op in python-dotenv.
  • .env.sample split, plus a new .env.secrets.sample.

The app needs no change: it reads os.environ (from compose in prod; the dev server sets ENVIRONMENT=development and loads no .env).

Checks:

  • docker compose config passes without a .env.secrets.
  • .env, .env.secrets and .env.triage are ignored; both samples are tracked.
  • The two scripts byte-compile. src/ is untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W8cMQN8Qa8jZk17v72poeo

Same split as flyfun-weather and flyfun-apps: plain configuration stays in
.env, secrets (DATABASE_URL, JWT_SECRET, GOOGLE_CLIENT_SECRET,
APPLE_PRIVATE_KEY) move to .env.secrets, which the owner's config repo keeps
sops-encrypted and syncfiles decrypts on the host (mode 600).

- docker-compose: .env.secrets as an optional second env_file (only
  HOST_DATA_DIR is interpolated, so nothing is blanked by the split).
- .gitignore / .dockerignore: .env.* ignored, samples re-included. The old
  `.env` entries did not match .env.secrets (public repo; image context).
- scripts/asc.py, scripts/play.py: load .env.secrets after .env.
- .env.sample split, new .env.secrets.sample.

No code path changes: the app reads os.environ (compose in prod; the dev
server sets ENVIRONMENT=development and loads no .env).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W8cMQN8Qa8jZk17v72poeo
@claude

claude Bot commented Nov 5, 2026

Copy link
Copy Markdown

Code Review

Reviewed the .env / .env.secrets split across compose, ignore files, the asc/play scripts and the samples. The change is a no-op until a host has .env.secrets, and src/ is untouched. No privacy, form-output, sync or localisation impact, and I found no issues. Note that required: false on env_file needs Docker Compose ≥ 2.24 on the host.

🤖 Generated with Claude Code

@roznet
roznet merged commit 0abea6d into main Nov 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant